package com.xiaoke.util.pay;

import com.github.wxpay.sdk.WXPayConfig;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
@Configuration
@ConfigurationProperties(prefix = "wx.miniapp")
public class WXConfig implements WXPayConfig {
    private byte[] certData;
    private String appID;
    private String mchID;
    private String key;
    private String notifyUrl;
    private String secret;
    private String openidUrl;
    private String spbillCreateIp;


    @Override
    public String getAppID() {
        return appID;
    }

    @Override
    public String getMchID() {
        return mchID;
    }

    @Override
    public String getKey() {
        return key;
    }

    public String getSpbillCreateIp() {
        return spbillCreateIp;
    }

    public String getNotifyUrl() {
        return notifyUrl;
    }

    public String getSecret() {
        return secret;
    }

    public String getOpenidUrl() {
        return openidUrl;
    }

    @Override
    public InputStream getCertStream() {
        ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
        return certBis;
    }

    @Override
    public int getHttpConnectTimeoutMs() {
        return 0;
    }

    @Override
    public int getHttpReadTimeoutMs() {
        return 0;
    }
}
